package com.game;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.view.MotionEvent;

public class Scene7 extends Scene {

	private Bitmap m_Background;
	private Bitmap m_Title;
	
	private ButtonOneTouch m_Stats, m_Howto, m_Back;
	
	private SlideBarVolume m_VolBar;
	private SlideBarDificulty m_DifBar;
	
	public Scene7(SceneManager parent)
	{
		super(parent);
		
		m_Background = LoadBitmap(R.drawable.scene7_bg);
		m_Title = LoadBitmap(R.drawable.scene7_title);
		
		m_Stats = new ButtonOneTouch(0, 50, 200, LoadBitmap(R.drawable.scene7_b1));
		m_Howto = new ButtonOneTouch(1, 50, 250, LoadBitmap(R.drawable.scene7_b2));
		m_Back = new ButtonOneTouch(2, 5, 280 , LoadBitmap(R.drawable.scene7_back));
		
		m_VolBar = new SlideBarVolume(218, 110, LoadBitmap(R.drawable.scene7_v0), LoadBitmap(R.drawable.scene7_vol_step));
		m_DifBar= new SlideBarDificulty(218, 160, LoadBitmap(R.drawable.scene7_d0), LoadBitmap(R.drawable.scene7_dif_low), 
				LoadBitmap(R.drawable.scene7_dif_med), LoadBitmap(R.drawable.scene7_dif_high));
		
	}
	
	@Override
	public void Draw(Canvas canvas) 
	{
		canvas.drawBitmap(m_Background, 0, 0, null);
		canvas.drawBitmap(m_Title, 80, 30, null);

		m_Stats.Draw(canvas);
		m_Howto.Draw(canvas);
		m_Back.Draw(canvas);
		
		m_VolBar.Draw(canvas);
		m_DifBar.Draw(canvas);
	}

	@Override
	public void End() {
		// TODO Auto-generated method stub

	}

	@Override
	public void Start() {
		// TODO Auto-generated method stub

	}

	@Override
	public void Update() 
	{
		if(m_Stats.Used()) { mParentSM.ChangeScene(new Scene8(mParentSM)); }
		if(m_Howto.Used()) { /*Change to howto */ }
		if(m_Back.Used()) { mParentSM.ChangeScene(new Scene1(mParentSM)); }

	}

	@Override
	public boolean handleTouch(MotionEvent event) 
	{
		synchronized (mSurfaceHolder) 
		{
			int tx,ty;
			tx = (int)event.getX();
			ty = (int)event.getY();
			
			m_Stats.TryTouch(tx, ty);
			m_Howto.TryTouch(tx, ty);
			m_Back.TryTouch(tx, ty);
			
			m_VolBar.HandleTouch(tx, ty);
			m_DifBar.HandleTouch(tx, ty);
			
		}
		return true;
	}

}
